package com.dms.modules.order.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("`order`")
@ApiModel("订单实体")
public class Order {
    
    @TableId(type = IdType.AUTO)
    @ApiModelProperty("订单ID")
    private Long id;
    
    @ApiModelProperty("订单编号")
    private String orderNo;
    
    @ApiModelProperty("用户ID")
    private Long userId;
    
    @ApiModelProperty("商家ID")
    private Long merchantId;
    
    @ApiModelProperty("订单总金额")
    private BigDecimal totalAmount;
    
    @ApiModelProperty("实付金额")
    private BigDecimal payAmount;
    
    @ApiModelProperty("运费")
    private BigDecimal freightAmount;
    
    @ApiModelProperty("订单状态（0-待付款，1-待发货，2-待收货，3-已完成，4-已取消）")
    private Integer status;
    
    @ApiModelProperty("支付时间")
    private LocalDateTime paymentTime;
    
    @ApiModelProperty("发货时间")
    private LocalDateTime deliveryTime;
    
    @ApiModelProperty("收货时间")
    private LocalDateTime receiveTime;
    
    @ApiModelProperty("收货地址快照")
    private String addressSnapshot;
    
    @ApiModelProperty("订单备注")
    private String remark;
    
    @ApiModelProperty("支付方式：支付宝、微信、银行卡等")
    private String paymentMethod;
    
    @ApiModelProperty("支付流水号")
    private String paymentNo;
    
    @ApiModelProperty("优惠金额")
    private BigDecimal discountAmount;
    
    @ApiModelProperty("优惠券ID")
    private Long couponId;
    
    @ApiModelProperty("优惠券抵扣金额")
    private BigDecimal couponAmount;
    
    @ApiModelProperty("是否需要发票：0-不需要 1-需要")
    private Integer invoiceRequired;
    
    @ApiModelProperty("发票信息")
    private String invoiceInfo;
    
    @ApiModelProperty("快递公司")
    private String deliveryCompany;
    
    @ApiModelProperty("快递单号")
    private String deliveryNo;
    
    @ApiModelProperty("取消原因")
    private String cancelReason;
    
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;
    
    @ApiModelProperty("更新时间")
    private LocalDateTime updateTime;

    @ApiModelProperty("购物车项ID列表，用逗号分隔")
    private String cartItemIds;

    @TableField(exist = false)
    @ApiModelProperty("订单项列表")
    private List<OrderItem> orderItems;
} 